package top.jidanmian.android.iot.mqtt

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class MyMqttModule {

    @Provides
    @Singleton
    fun provideMqttConn(@ApplicationContext context: Context): MyMqttConn {
        val myMqttConn = MyMqttConn(context)
        myMqttConn.init()
        myMqttConn.connect()
        return myMqttConn
    }
}